import store from "@/store"

export default {
    //指令名：{生命周期}
    imgerror:{
        inserted(dom,obj,vnode){
            dom.src=dom.src||obj.value
            dom.onerror=function(){
                dom.src=obj.value
            }
        },
        componentUpdated(dom,obj){
            dom.src=dom.src||obj.value
        },
        unbind(dom,obj){
dom.onerror=null
        }
    },
    //控制权限控制指令
    control:{
        inserted(dom,obj){
            if(!store.state.user.userInfo.roles.points.includes(obj.value)){
                dom.style.display='none'
            }
        },
        componentUpdated(dom,obj){
            if(!store.state.user.userInfo.roles.points.includes(obj.value)){
                dom.style.display='none'
        }}
    }
}